package cn.wangzg.course1202;

import android.animation.ObjectAnimator;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity2 extends AppCompatActivity {
    private ImageView imageView;
    private ImageView iv;
    private Button mButton;
    private AnimationDrawable animationDrawable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        imageView = findViewById(R.id.imageView);
        iv = findViewById(R.id.imageView2);
        mButton = findViewById(R.id.button5);
    }

    /**
     * printf("%d,%s,%f",a,c,c)
     * @param view
     */
    public void btnAlpha(View view) {

        //透明度起始为1，结束时为0
        ObjectAnimator animator = ObjectAnimator.ofFloat(mButton,
                "alpha", 1f, 0f,1);
        animator.setDuration(3000);//时间1s
        animator.start();
    }

    public void btnRotate(View view) {

    }

    public void btnScale(View view) {
        /**
         * 1:作用的对象
         * 2：要修改的属性，setScaleX ，去掉set，首字符小写，得到属性
         * 3：变长的参数，任意多个，指的是属性变化的区间
         */
        ObjectAnimator animator = ObjectAnimator.ofFloat(mButton,
                "scaleX", 1f, 2f,1);
        animator.setDuration(3000);//时间1s
        animator.start();
    }

    public void btnTranslate(View view) {

    }
    
    public void btnTest(View view){
        Toast.makeText(this, "click", Toast.LENGTH_SHORT).show();

    }
}
